//
//  LookDataViewController.m
//  sentorise
//
//  Created by admin on 2025/9/4.
//

#import "LookDataViewController.h"
#import "BTManager.h"
#import "GlobalDefine.h"

@interface LookDataViewController ()<UITableViewDelegate, UITableViewDataSource>

@property (weak, nonatomic) IBOutlet UITableView *tableView;

@end

@implementation LookDataViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"UITableViewCell"];
}

- (IBAction)actionBack:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [BTManager sharedBTManager].advertisementDataDict.allKeys.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"UITableViewCell"];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    [cell.contentView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
    
    UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, kWidth, 40)];
    title.text = [BTManager sharedBTManager].advertisementDataDict.allKeys[indexPath.row];
    [cell.contentView addSubview:title];
    
    UILabel *content = [[UILabel alloc] initWithFrame:CGRectMake(0, 40, kWidth, 310)];
    content.text = [NSString stringWithFormat:@"%@", [BTManager sharedBTManager].advertisementDataDict[[BTManager sharedBTManager].advertisementDataDict.allKeys[indexPath.row]]];
    content.numberOfLines = 0;
    [cell.contentView addSubview:content];
    
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 350;
}


@end
